import { nextTick, ref } from 'vue'
import { storeToRefs } from 'pinia'
import { useMapStore } from '@/stores/map.js'

const { map } = storeToRefs(useMapStore())
export const useChangeEventPopup = () => {
  let position = ref({})
  nextTick(() => {
    map.value.on('click', (e) => {
      position.value.top = e.pixel[1] + 'px'
      position.value.left = e.pixel[0] + 'px'
    })
  })
  return { position }
}
